package com.aaa.controller;

import com.aaa.entity.Emp;
import com.aaa.service.EmpService;
import com.aaa.vo.Result;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
public class EmpController {
    @Resource
    private EmpService empService;
    @ApiImplicitParams(
            value = {
                    @ApiImplicitParam(name="current",value = "当前页面",dataType = "int",required = true),
                    @ApiImplicitParam(name="pageSize",value = "页面显示条数",dataType = "int",required = true)
            }
    )
    @ApiOperation(value = "根据分页显示员工信息")
    @GetMapping("/select")
    public Result selectAll(Integer current,Integer pageSize){
        return empService.select(current,pageSize);
    }
    @ApiOperation(value = "添加员工信息")
    @PostMapping("/insert")
    public Result insertemp(@RequestBody Emp emp){
        return empService.insert(emp);
    }
    @ApiOperation(value = "根据员工编号更新员工信息")
    @PutMapping("/update")
    public Result updateemp(@RequestBody Emp emp){
        return empService.update(emp);
    }
    @ApiOperation(value = "根据员工编号删除员工信息")
    @DeleteMapping("/delete")
    public Result deleteemp(Integer id){
        return empService.delete(id);
    }
}
